import { Notices } from "../../models/Notices"
import { isEmpty } from "../../utils"

// 创建的表单参数
export function validateCreateForm(form: Notices) {
  let message = ''
  const params = new Map([
    ['publisher', '发布者'],
    ['subscriber', '接收者'],
    ['pub_date', '发布日期'],
    ['title', '公告标题'],
    ['content', '公告内容'],
  ])
  
  params.forEach((val, key) => {
    if (isEmpty(form[key])) {
      message = `缺少必填参数-${val}!`
    }
  })
  return message
}